/*Read Yams newmail whith IBrowse
fixa så man kan välja bort requestern vid autoyam (ingen ibrowse startad)
eller kanske starta ib ??
*/
OPTIONS RESULTS
call addlib('libs:rexxreqtools.library',0,-30)
NL='0a'x /* newline */
NLNL='0a0a'x /* 2 newlines */
fileinc=' '
repl='
'
new='
'
fresh='
'
title='Newmail by sorenf@hem1.passagen.se 1998'
what_but='_IBrowse|_Yam|Cancel'
tags='rt_pubscrname=IBROWSESCREEN' /* Change here the name of the screen IBROWSE runs */
IF ~SHOW('Ports','YAM') THEN DO
ADDRESS 'COMMAND'
'Run >NIL: YAM:YAM HIDE'
'SYS:RexxC/WaitForPort YAM'
END
IF EXISTS('sys:c/play16') THEN DO
IF EXISTS('Ibrowse:rexx/mailsound.wav') THEN DO
ADDRESS 'COMMAND'
'Run >NIL: play16 >NIL: Ibrowse:rexx/mailsound.wav'
END
END
where_txt='There is mail for You! Select viewer.'
sel=rtezrequest(where_txt,what_but,title,'rtez_defaultresponse=1')
if sel=0 then Exit
if sel=2 then do
ADDRESS 'YAM'
show
setfolder 0
exit
end
IF ~SHOW('Ports','IBROWSE') THEN DO
ADDRESS 'COMMAND'
'Run >NIL: IBROWSE:IBrowse'
'SYS:RexxC/WaitForPort IBROWSE'
END
IF SHOW('Ports','IBROWSE') THEN DO
ADDRESS 'COMMAND'
'copy IBrowse:Rexx/mailfile.iff ram:t/'
'copy IBrowse:Rexx/mailrep.iff ram:t/'
'copy IBrowse:Rexx/mailnew.iff ram:t/'
'copy IBrowse:Rexx/mailfresh.iff ram:t/'
IF EXISTS('IBrowse:Rexx/mailback.iff') THEN 'copy IBrowse:Rexx/mailback.iff ram:t/ >NIL:'
ADDRESS YAM
SetFolder 0
GetFolderinfo MAX; max=RESULT
a=0
app=''
linkpage='
Here are your new mail.'||NL DO WHILE a') close('outputfile') END a=a+1 END linkpage=linkpage||'' open('outputfile','RAM:T/newmail.html','W') line=writeln('outputfile',linkpage) close('outputfile') ADDRESS 'IBROWSE' GOTOURL URL 'file://localhost/RAM:T/newmail.html' END exit'||email||''||NL titel='From: '||name||'Subject: '||subject open('inputfile',file,'R') b=1 list='' DO FOREVER line=readln('inputfile') appex=pos('application/octet-stream',line) IF appex~=0 then BREAK list=list||line||NL IF EOF('inputfile') THEN BREAK END close('inputfile') linkpage=linkpage||''||titel||'' if status='N' then titel=titel||fresh if status='U' then titel=titel||new if status='N' then linkpage=linkpage||fresh if status='U' then linkpage=linkpage||new if appex~=0 then titel=titel||fileinc if appex~=0 then linkpage=linkpage||fileinc linkpage=linkpage||NL len=length(list) texttype='text/plain' htmlpos=pos('text/html',list) IF htmlpos~=0 THEN texttype='text/html' textpos=pos(texttype,list) IF textpos=0 THEN textpos=pos('X-UIDL:',list) startpos=pos(NLNL,list,textpos) out =substr(list,startpos,len-startpos) endpos=pos('boundary=',list) if endpos~=0 THEN DO outlen=LENGTH(out) boundary=SUBSTR(list,endpos+10,24) endpos=pos(boundary,out) endpos=lastpos(NL,out,endpos) out=LEFT(out,endpos) END open('outputfile','RAM:T/newmail'a'.html','W') line=writeln('outputfile',' '||titel) line=writeln('outputfile','Mail to: '||mailto) IF htmlpos~=0 THEN line=writeln('outputfile','') line=writeln('outputfile',out) IF htmlpos=0 THEN line=writeln('outputfile','